#pragma once

#include "ReflectableForwardLinkedList.h"
#include "ReflectableVector.h"
#include "Containers/Vector.h"

class CForwardLinkedListGeneralized;

// non-templated version of TMap<Key,Value>, can force convert from/to TMap<Key,Value>
class CReflectableMap
{
protected:
    CReflectableVector Data; 

	uint64_t Capacity = 16;
	//how manay pair
	uint64_t Size = 0;
public:
	CReflectableMap(CForwardLinkedListGeneralized *InForwardLinkedListType);

	CReflectableMap(CForwardLinkedListGeneralized *InForwardLinkedListType,  const CReflectableMap& InMap);

    void Add(CForwardLinkedListGeneralized *InForwardLinkedListType, void * InPair); 
	void Add(CForwardLinkedListGeneralized *InForwardLinkedListType, void* InKey, void* InValue); 

	void Remove(CForwardLinkedListGeneralized *InForwardLinkedListType, void * InKey);

 
	//return the value of the key, if not exist, return nullptr
	void* FindValue(CForwardLinkedListGeneralized *InForwardLinkedListType, void * InKey) const;
	bool Contains(CForwardLinkedListGeneralized *InForwardLinkedListType, void * InKey) const;
	TVector<void*> NativeGetKeys(CForwardLinkedListGeneralized *InForwardLinkedListType) const ;
	TVector<void*> NativeGetValues(CForwardLinkedListGeneralized *InForwardLinkedListType) const;

	void Clear(CForwardLinkedListGeneralized *InForwardLinkedListType);

	uint64_t GetHashCode (CForwardLinkedListGeneralized *InForwardLinkedListType) const;
	bool IsEqual (CForwardLinkedListGeneralized *InForwardLinkedListType, const CReflectableMap& InMap) const;
protected:
    void MakesureCapacity(CForwardLinkedListGeneralized* InForwardLinkedListType);
};